package ru.kvolkov.myreader.ui;

import android.os.Bundle;
import android.view.View;

import ru.kvolkov.myreader.R;

/** 
 * Represents a Home activity 
 */
public class HomeActivity 
extends BaseActivity 
implements OpenFileCallback {
    /** 
     * Called when the activity is first created. 
     */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.home);
        
        registerOnClickListener(R.id.open_file_button);
        registerOnClickListener(R.id.about_button);
        registerOnClickListener(R.id.exit_button);
    }

	/** 
	 * Called when activity element was clicked. 
	 */
	@Override
	public void onClick(View view) {
		int id = view.getId();
		switch (id) {
			case R.id.open_file_button:
				new OpenFileDialog(this, this).show();
				break;
			case R.id.about_button:
				AboutDialog.show(this);
				break;
			case R.id.exit_button:
				finish();
				break;
		}
	}

	/** 
	 * Called when file was selected 
	 */
	@Override
	public void onFileSelected(String fileName) {
	}
}